import java.util.Scanner;

public class Method {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        boolean ret = isLeapYear(a);
        System.out.println(ret);
        int x = scanner.nextInt();
        ;
        int y = scanner.nextInt();
        int ret1 = add(x, y);
        System.out.println("x+y的和为： " + ret1);
        int b = scanner.nextInt();
        int ret2 = fac(b);
        int c = scanner.nextInt();
        int ret3 = facNum(c);
        System.out.println("阶乘之和为： "+ret3);
    }

    //实现函数，判断一个年份是否为闰年：
    public static boolean isLeapYear(int year) {
        if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) {
            return true;
        } else {
            return false;
        }
    }

    //实现函数，计算两个数的和：
    public static int add(int x, int y) {
        return x + y;
    }
    //实现函数，计算一个数的阶乘：
    public static int fac(int n) {
        int ret = 1;
        for (int i = 1; i <= n; i++) {
            ret *= i;
        }
        System.out.println(n + " 的阶乘为： " + ret);
        return ret;
    }
    //实现函数：1-n 的阶乘之和：
    public static int facNum(int n){
        int sum = 0;
        for(int i = 1;i <= n;i++){
            sum += fac(i);
        }
        return sum;
    }
}

